﻿
namespace BEGDC.PreContract.DAL
{
    using System;
    using System.Collections.Generic;
    using Castle.ActiveRecord;
    using NHibernate.Expression;


    [ActiveRecord]
    public partial class ContractDelivery : ActiveRecordBase<ContractDelivery>
    {
		#region Const Definition
		
		public const string CONST_ContractDeliveryID					= "ContractDeliveryID";
		public const string CONST_PreContractID							= "PreContractID";
		public const string CONST_Percentage							= "Percentage";
		public const string CONST_UpdateDate							= "UpdateDate";
		public const string CONST_Comments								= "Comments";

		#endregion
		
        #region Member Variables
        // Primary Key
        private System.Int32 _contractDeliveryID;
        
        // Non Key
        private Nullables.NullableDecimal _percentage;
        private Nullables.NullableDateTime _updateDate;
        private System.String _comments;

        // Parents
        private PreContractInfo _preContractID;
        
        
		

        #endregion

        public ContractDelivery() {
               
        }
        public ContractDelivery(
            Nullables.NullableDecimal percentage
            ,Nullables.NullableDateTime updateDate
            ,System.String comments) : this() {
                
            this._percentage = percentage; 
            this._updateDate = updateDate; 
            this._comments = comments; 
        }
        
        #region Properties
        // Primary Key        
		
		#if (SQLServer)
        [PrimaryKey]
		#else
		[PrimaryKey(PrimaryKeyType.Native, SequenceName = "SEQ_CONTRACTDELIVERY_CONTRACTDELIVERYID")]
		#endif
        public System.Int32 ContractDeliveryID {
            get { return this._contractDeliveryID; }
            set {  this._contractDeliveryID = value; }
        }
        
        // Non Key
        [Property]
        public Nullables.NullableDecimal Percentage {
            get { return this._percentage; }
			set { this._percentage = value; }
        }
        
        [Property]
        public Nullables.NullableDateTime UpdateDate {
            get { return this._updateDate; }
			set { this._updateDate = value; }
        }
        
        [Property]
        public System.String Comments {
            get { return this._comments; }
			set { if (value == null) return; if (value.Length > 1000) this._comments = value.Substring(0,1000); else this._comments = value; }	
        }
        
        
        // Parent Relationships
        [BelongsTo("PreContractID")]
        public PreContractInfo PreContractID {
            get { return this._preContractID; }
            set { this._preContractID = value; }
        }
        
        // Child Relationships
        
		
        #endregion
		
		// Clone
		public ContractDelivery Clone()
		{
			ContractDelivery newContractDelivery = new ContractDelivery();
			
            newContractDelivery.Percentage = this._percentage; 
            newContractDelivery.UpdateDate = this._updateDate; 
            newContractDelivery.Comments = this._comments; 
            newContractDelivery.PreContractID = this._preContractID ; 
			return newContractDelivery;
		}
    }
}



